<template>
	<view class="box">
		<view class="head">
			<view class="head_left" @longpress="gantlet">
				<image src="http://oos-cn.ctyunapi.cn/hfclass/%E5%9B%BE%E6%A0%8760.png?Signature=UrYgwLG4CK%2BKi3AjTkyroLGl1P8%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101116"
				 style="width: 60rpx;height: 60rpx;margin-right: 20rpx;"></image>
				<text>每日数据上报</text>
			</view>
			<!-- <view>每日数据上报</view> -->
			<view class="head_right">
				<image src="http://oos-cn.ctyunapi.cn/hfclass/daohang.png?Signature=jOPgTuFm5zq91ZzyG/5RB961wnY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101193"
				 style="width: 36rpx;height: 36rpx;" @click="set"></image>
				<view class="windows" v-if="IsSet">
					<view class="windows_box">
						<view @click="message">上报人</view>
						<view @click="mit">提交记录</view>
						<view @click="relieve">清理缓存</view>
					</view>
				</view>
			</view>
		</view>

		<view class="dian"></view>
		<view class="content" @click="IsSet=false">
			<view class="imgt">
				<image src="http://oos-cn.ctyunapi.cn/hfclass/appbanner.jpg?Signature=JMC4Sf44c3yvOAQwyQR94dccwRo%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=1698476976"></image>
			</view>
			<view class="cu-form-group">
				<view class="title">选择上报人</view>
				<picker @change="hange" :value="index" :range="pick">
					<view class="picker">
						{{index>-1?pick[index]:'选择'}}
					</view>
				</picker>
			</view>
			<view class="school">
				<view class="date">
					<view>日期选择</view>
					<view>
						<text>{{date}}</text>
						<!-- <image src="http://111.62.51.251:8081/hfclass/选择箭头15X22.png"></image> -->
					</view>
				</view>
			</view>

			<view class="AnimalHeat">
				<view>
					<view>填写体温</view>
					<input type="number" maxlength="4" @input="pur" placeholder="填写体温" v-model="tiwen" />
				</view>
			</view>
			<view class="AnimalHeat">
				<view>
					<view>检测人</view>
					<input type="text" maxlength="5" @input='man' placeholder="填写检测人" v-model="person" />
				</view>
			</view>
			<view class="box_one">
				<view class="boxEs">
					<view>
						<text style="color: #0081FF;">单选</text>
						<text>是否出现下列四种情况？</text>
					</view>
					<view class="radios" @click="rod(index)" v-for="(item,index) in lisp" :key='index'>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E4%B8%AD24X24.png?Signature=uadBOt7JPRWF1p%2BYdBuY9uJvJO0%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101415"
						 v-if="index==grt" style="width: 40rpx;height: 40rpx;"></image>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E6%9C%AA%E9%80%89%E4%B8%AD24X24.png?Signature=v//XYi/k9NaPp0RRUYa8gALBcSY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101610"
						 v-else style="width: 40rpx;height: 40rpx;"></image>
						<text style="margin-left: 20rpx;">{{item.value}}</text>
					</view>
				</view>
			</view>
			<view class="box_one">
				<view class="boxEs">
					<view>
						<text style="color: #0081FF;">单选</text>
						<text>你的家人朋友是否出现下列四种情况？</text>
					</view>
					<view class="radios" @click="on=index" v-for="(item,index) in list" :key='index'>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E4%B8%AD24X24.png?Signature=uadBOt7JPRWF1p%2BYdBuY9uJvJO0%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101415"
						 v-if="index==on" style="width: 40rpx;height: 40rpx;"></image>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E6%9C%AA%E9%80%89%E4%B8%AD24X24.png?Signature=v//XYi/k9NaPp0RRUYa8gALBcSY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101610"
						 v-else style="width: 40rpx;height: 40rpx;"></image>
						<text style="margin-left: 20rpx;">{{item.value}}</text>
					</view>
				</view>
			</view>
			<view class="box_one rttt">
				<view class="boxEs">
					<view>
						<text style="color: #0081FF;">单选</text>
						<text>救治及防护措施</text>
					</view>
					<view class="radios" @click="ins=index" v-for="(item,index) in liser" :key='index'>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E4%B8%AD24X24.png?Signature=uadBOt7JPRWF1p%2BYdBuY9uJvJO0%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101415"
						 v-if="index==ins" style="width: 40rpx;height: 40rpx;"></image>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E6%9C%AA%E9%80%89%E4%B8%AD24X24.png?Signature=v//XYi/k9NaPp0RRUYa8gALBcSY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101610"
						 v-else style="width: 40rpx;height: 40rpx;"></image>
						<text style="margin-left: 20rpx;">{{item.value}}</text>
					</view>
				</view>
			</view>
			
			<view class="box_one rttt" v-show="grt==0||grt==1||grt==2||grt==3">
				<view class="boxEs">
					<view>
						<text style="color: #0081FF;">单选</text>
						<text>是否经过核酸检测</text>
					</view>
					<view class="radios" @click="ins5=index" v-for="(item,index) in hsjc" :key='index'>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E4%B8%AD24X24.png?Signature=uadBOt7JPRWF1p%2BYdBuY9uJvJO0%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101415"
						 v-if="index==ins5" style="width: 40rpx;height: 40rpx;"></image>
						<image src="http://oos-cn.ctyunapi.cn/hfclass/%E6%9C%AA%E9%80%89%E4%B8%AD24X24.png?Signature=v//XYi/k9NaPp0RRUYa8gALBcSY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101610"
						 v-else style="width: 40rpx;height: 40rpx;"></image>
						<text style="margin-left: 20rpx;">{{item.value}}</text>
					</view>
				</view>
			</view>
			
			<view v-show="grt==0||grt==1||grt==2||grt==3">
				<view class="box_one rttt" v-show="ins5==0">
					<view class="boxEs">
						<view>
							<text style="color: #0081FF;">单选</text>
							<text>第一次检测情况</text>
						</view>
						<view class="radios" @click="ins6=index" v-for="(item,index) in firstList" :key='index'>
							<image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E4%B8%AD24X24.png?Signature=uadBOt7JPRWF1p%2BYdBuY9uJvJO0%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101415"
							 v-if="index==ins6" style="width: 40rpx;height: 40rpx;"></image>
							<image src="http://oos-cn.ctyunapi.cn/hfclass/%E6%9C%AA%E9%80%89%E4%B8%AD24X24.png?Signature=v//XYi/k9NaPp0RRUYa8gALBcSY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101610"
							 v-else style="width: 40rpx;height: 40rpx;"></image>
							<text style="margin-left: 20rpx;">{{item.value}}</text>
						</view>
					</view>
				</view>
				<view class="box_one rttt" v-show="ins5==0">
					<view class="boxEs">
						<view>
							<text style="color: #0081FF;">单选</text>
							<text>第二次检测情况</text>
						</view>
						<view class="radios" @click="ins7=index" v-for="(item,index) in twoList" :key='index'>
							<image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E4%B8%AD24X24.png?Signature=uadBOt7JPRWF1p%2BYdBuY9uJvJO0%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101415"
							 v-if="index==ins7" style="width: 40rpx;height: 40rpx;"></image>
							<image src="http://oos-cn.ctyunapi.cn/hfclass/%E6%9C%AA%E9%80%89%E4%B8%AD24X24.png?Signature=v//XYi/k9NaPp0RRUYa8gALBcSY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101610"
							 v-else style="width: 40rpx;height: 40rpx;"></image>
							<text style="margin-left: 20rpx;">{{item.value}}</text>
						</view>
					</view>
				</view>
				<view class="box_one rttt" v-show="ins5==0">
					<view class="boxEs">
						<view>
							<text style="color: #0081FF;">单选</text>
							<text>本人现在所处地域是否省内</text>
						</view>
						<view class="radios" @click="ins8=index" v-for="(item,index) in site" :key='index'>
							<image src="http://oos-cn.ctyunapi.cn/hfclass/%E9%80%89%E4%B8%AD24X24.png?Signature=uadBOt7JPRWF1p%2BYdBuY9uJvJO0%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101415"
							 v-if="index==ins8" style="width: 40rpx;height: 40rpx;"></image>
							<image src="http://oos-cn.ctyunapi.cn/hfclass/%E6%9C%AA%E9%80%89%E4%B8%AD24X24.png?Signature=v//XYi/k9NaPp0RRUYa8gALBcSY%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585101610"
							 v-else style="width: 40rpx;height: 40rpx;"></image>
							<text style="margin-left: 20rpx;">{{item.value}}</text>
						</view>
					</view>
				</view>
				<view class="box_one" v-show="ins5==1||ins7==3">
					<view class="weiConent">
						<view>未进行核酸检测原因及其他需要说明的事项</view>
						<textarea  placeholder="请填写内容" v-model="texent"/>
					</view>
				</view>
			</view>
			
			
			
			<view class="submit">
				<view :class="grt!=4?'grtReds':''" @click="sub">提交信息</view>
			</view>
		</view>

        <view class="cu-modal" :class="modalName=='Image'?'show':''">
        	<view class="cu-dialog">
        		<view style="text-align: center;font-size: 50rpx;font-weight: 900;">上报成功！</view>
                <image :src="urls" style="height:137rpx;width:194rpx; background-size: 100% 100%; margin: 50rpx 0;"></image>
        		<!-- <view class="xinwentex" style="height: 460rpx; overflow-y: auto;overflow-x: hidden;"> -->
					<!-- <view style="text-align: center;color: #0081FF;font-weight: bold;">乐亭县新冠肺炎疫情防控工作总指挥部办公室</view>
					<view style="text-align: center;color: #0081FF;font-weight: bold;">关于紧急寻找相关密切接触者的通告</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>2021年1月20日，乐亭县疾控中心接唐山市疾控中心转发秦皇岛市疾控中心协查函，我县李某1月14日与核酸阳性人员乘同一航班返乡，判定为密切接触者，李某1月14日以来具体的行程轨迹如下：</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>1月14日6:55李某由上海浦东机场乘坐FM9141航班出发，座位号36J，
						当日9点到达北戴河机场。出航站楼后，由秦皇岛昌黎拼车司机曹某自驾车接
						机，10:20到达金融大街与发展大道交叉口的骏怡酒店，与妻子办理住宿。
						17:20-18:08与妻子步行到大东方购物广场（东城店）购物。17:20-17:40先到
						大东方二楼意尔康专柜买鞋，17:40-18:08到一楼水果蔬菜零食区购物，18:08
						交款后出大东方。与妻子步行18:20到达大东方购物广场（东城店）对面蟹煲、
						烤鸭店旁边的东北铁锅炖吃晚饭，19:20李某回到骏怡酒店，妻子回家，途中
						一直佩戴口罩。
					</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>1月15日上午未外出，12:00-12:15李某与妻子到吉祥馄饨馆吃午饭。下午未外出，18:30-18:51到岑科饺子馆打包后回到骏怡宾馆。</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>16日早上8:30退房，妻子自驾车接李某回家，李某未外出。</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>17日早上10:30-11:30一家人自驾车带孩子到青春广场玩耍，12:00到家
						后未外出。下午14:00拼车到唐山，车上一共有5人。到达唐山百货大楼附近
						后司机离开，并联系同车4人换乘另一辆出租车15:30到达唐山火车站。16:02
						乘坐高铁G1230，08车厢08D座位号回上海。
					</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>在此提醒广大居民，如有人在上述时间段与其有密切接触的，请立即与县
						防控办、县疾控中心、所在乡镇（街道）报告，并立即居家隔离暂时不得外出，
						等待县防控办进一步安排。若有发热、咳嗽等症状，要立即拨打防控办联系电
						话。如县疾控中心排除您密切接触的可能，请您在规范做好个人防护情况下，
						就近到县医院、中医院、大钊路茂源社区卫生服务站进行核酸检测，并落实好
						相关防控措施。出行时不得乘坐公共交通工具，如有隐瞒不报，一旦造成后果，
						将依法追究相关人员责任。
					</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>请广大居民积极配合各项防控措施的落实，不必恐慌，做到不信谣，不传谣，时刻增强个人防护意识，规范佩戴口罩，保持合理的社交距离。</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>乐亭县防控办联系电话：0315-4621198</view>
					<view style="margin-top: 10rpx;"><text style="color: #FFFBE9;">1&#12288;1</text>乐亭县疾控中心联系电话：0315-5226008</view>
					
					<view style="text-align: right;margin-top: 30rpx;">乐亭县新冠肺炎疫情防控工作总指挥部办公室</view>
					<view style="text-align: right;">2021年1月20日</view> -->
				<!-- </view> -->
				<view class="qued flexc">
					<view class="flexc" @tap="hideModal">关闭</view>
				</view>
        	</view>
        </view>


		<view v-if="loadModal" class="MaskLayer"></view>
		<view class="gif" v-if="loadModal">
			<view>
				<image src="http://oos-cn.ctyunapi.cn/hfclass/jiazai.gif?Signature=OgNX%2BUIeALb4HM35vCGC1jX%2BZEw%3D&AWSAccessKeyId=65b300139cc5a0aa9572&Expires=865585100785"></image>
				<view>请耐心等待！</view>
			</view>
		</view>

		<view v-if="IsRelieve" class="MaskLayer" @click="IsSet=false"></view>
		<view class="CPM" v-if="IsRelieve">
			<view class="CPM_box">
				<view>添加上报人信息</view>
				<view @click="confirm">确定</view>
			</view>
		</view>
	</view>
</template>

<script>
	import App from '../../App.vue'
	export default {
		data() {
			return {
				urls:'/static/tabbar/sbcg.png',
				modalName:'',
				date: "",
				IsSet: false,
				IsRelieve: false,
				tiwen: '',
				person: '',
				listOpp: {},
				hsjc:[{value:'是'}, {value:'否'}],//是否经过核酸检测
				firstList:[{value:'阴性'}, {value:'阳性'}, {value:'等待检测结果'}],//第一次检测情况
				twoList:[{value:'阴性'}, {value:'阳性'}, {value:'等待检测结果'},{value:'未检测'}],//第二次检测情况
				site:[{value:'是'}, {value:'否'}],//本人现在所处地域
				userId: "",
				ins5:1,
				ins6:null,
				ins7:null,
				ins8:1,
				texent:'',
				lisp: [{
					value: '确诊'
				}, {
					value: '疑似'
				}, {
					value: '密切接触者'
				}, {
					value: '发热人员'
				}, {
					value: '无'
				}],
				list: [{
					value: '确诊'
				}, {
					value: '疑似'
				}, {
					value: '密切接触者'
				}, {
					value: '发热人员'
				}, {
					value: '无'
				}],
				liser: [{
					value: '住院治疗'
				}, {
					value: '定点隔离'
				}, {
					value: '无'
				}],
				grt: 4,
				on: 4,
				ins: 2,
				temperature: '',
				loadModal: false,
				pick: [],
				arrId: [],
				istrue: '',
				isop: '',
				index: -1,
				isFalse:true,
				times:null
			}
		},
		onShow() {
			// uni.clearStorageSync('storage_key');
			//就用我这个把this.$route.query ok？  所以有些小问题uniapp得其他方式解决
			if (this.$route.query.index) {
				this.index = this.$route.query.index
			}
			this.getTime() //获取时间
			//this.getopp()
			var that = this
			
			const ArrId=uni.getStorageSync('ArrId')
			// console.log(ArrId)
			if(ArrId.length==0||ArrId==''||ArrId==[]){
				that.loadModal = true
				uni.request({
					method: 'POST',
					url: App.globalData.baseUrl + '/api/services/app/organUser/GetBingList',
					success(res) {
						that.pick = []
						if (res.data.success == true) {
							const ultarr = res.data.result
							ultarr.sort(function(a, b) {
								return b.name.length - a.name.length
							})
							if (ultarr.length == 1 && ultarr[0].address == null && ultarr[0].familyCount == 0 && ultarr[0].identityNumber ==
								null &&
								ultarr[0].name == '' && ultarr[0].phoneNumber == null) {
								that.userId = ultarr[0].userId
								that.loadModal = false
								that.IsRelieve = true
							} else {
								
								that.arrId = ultarr
								uni.setStorageSync('ArrId', that.arrId)
								ultarr.forEach((item, index) => {
									that.pick.push(item.name)
								})
				
								if (ultarr.length > 0 & that.index == -1) {
									that.index = 0
								}
								that.loadModal = false
								that.IsRelieve = false
							}
						} else {
							that.loadModal = false
							that.IsRelieve = false
							uni.showToast({
								title: res.data.error.message,
								duration: 2000,
								icon: 'none'
							})
							if (res.data.error.code == 401) {
								
								uni.showToast({
									icon: 'none',
									duration: 2000,
									title: '马上开始重新登录'
								})
				
								let cl = setTimeout(() => {
									window.location.href = '/wx/GetCode'
									clearTimeout(cl)
								}, 2000)
				
							}
						}
					},
					fail(res) {
						uni.showToast({
							icon: 'none',
							duration: 2000,
							title: '未登录'
						})
						let cl = setTimeout(() => {
							window.location.href = '/wx/GetCode'
							clearTimeout(cl)
						}, 2000)
					}
				})
			}else{
				that.pick=[]
				that.arrId = ArrId
				that.arrId.forEach((item, index) => {
					that.pick.push(item.name)
				})
				if (that.arrId.length > 0 & that.index == -1) {
					that.index = 0
				}
			}
			
			that.getResArr()
		},
		methods: {
			getResArr(){
				let that=this
				const resArr=uni.getStorageSync('resArr')
				// console.log(resArr)
				if(resArr.length==0||resArr==[]||resArr==''){
					// console.log(11111111)
					let resArr=[]
					uni.setStorageSync('resArr', resArr)
				}else{
					// console.log(11111, that.date)
					let me=resArr.some((item)=>{
						return that.date>item.date
					})
					if(me==true){
						uni.removeStorageSync('resArr');
						window.location.reload()
					}else{
						// console.log(11111111)
						let mes=resArr.some((item)=>{
							return item.date==''||item.date==undefined||item.date.length==0
						})
						if(mes==true){
							uni.removeStorageSync('resArr');
							window.location.reload()
						}
					}
				}
			},
			ahref(){ //弹窗
				window.location.href='https://mp.weixin.qq.com/s/oWTuxsWwqNO7Ho4p_rgtZA'
			},
            hideModal(e) {
            	this.modalName = null
            },
			gantlet() {
				uni.request({
					method: 'POST',
					url: App.globalData.baseUrl + '/api/services/app/session/GetCurrentServerInformations',
					data: {
						"serverName": "",
						"serverIp": ""
					},
					success(res) {
						uni.showModal({
							title: '服务器信息',
							content: '地址：' + res.data.result.serverIp + '  ' + '名称：' + res.data.result.serverName,
							success: function(res) {
								// if (res.confirm) {

								// } else if (res.cancel) {

								// }
							}
						});
					}
				})
			},

			set() {
				if (this.IsRelieve == false) {
					this.IsSet = !this.IsSet
				}
			},
			rod(index) {
				var that = this
				if(that.tiwen==''||that.tiwen==null){
					uni.showToast({
						title: '请先填报体温',
						duration: 2000,
						icon: 'none'
					})
				}else if(index==4 && that.tiwen >= 37.3){}else if(index==0||index==1||index==2||index==3){
					that.grt = index
					uni.showToast({
						title: '你已填报为异常人员',
						duration: 2000,
						icon: 'none'
					})
				}else{
					that.grt = index
				}
				
			},
			
		
			pur(e) {
				var that = this
				that.temperature = e.detail.value
				if (that.temperature.length >= 2) {
					if (that.temperature >= 35 & that.temperature < 42) {
						if (that.temperature >= 37.3) {
							that.grt = 3
						} else {
							that.grt = 4
						}
					} else {
						that.tiwen = ''
						that.grt = 4
						uni.showToast({
							title: '请输入正常体温',
							icon: 'none',
							duration: 2000
						})
					}
				} else if (that.temperature.length <= 1) {
					that.grt = 4
				}
			},
			man(e) {
				let that = this
				that.person = e.detail.value
				if (that.person.length > 0) {
					that.person = that.person.replace(/[^\u4E00-\u9FA5]/g, '')
					if (that.person == '') {
						uni.showToast({
							title: '请输入中文',
							duration: 2000,
							icon: 'none'
						})
					}
				}
			},
			getTime() {
				let date = new Date(),
					that = this
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				var strDate = date.getDate();
				var hours=date.getHours()
				var minutes=date.getMinutes()
				if (month >= 1 && month <= 9) {
					month = "0" + month;
				}
				if (strDate >= 0 && strDate <= 9) {
					strDate = "0" + strDate;
				}
				that.date = year + '-' + month + '-' + strDate;
				that.times =Number(hours*60)+Number(minutes);
			},
			relieve() {
				var that = this
				that.loadModal = true
				uni.request({
					method: 'POST',
					url: App.globalData.baseUrl + '/api/services/app/organUser/RemoveSelfCache',
					data: {},
					success(res) {
						that.loadModal = false
						if (res.data.success == true) {
							uni.removeStorageSync('resArr');
							uni.removeStorageSync('ArrId');
							uni.showToast({
								icon: 'none',
								duration: 2000,
								title: '操作成功'
							})
							let cl = setTimeout(() => {
								window.location.reload()
								clearTimeout(cl)
							}, 2000)


						} else {
							uni.showToast({
								icon: 'none',
								duration: 2000,
								title: res.data.error.message
							})

							if (res.data.error.code == 401) {
								
								uni.showToast({
									icon: 'none',
									duration: 2000,
									title: '马上开始重新登录'
								})

								let cl = setTimeout(() => {
									window.location.href = '/wx/GetCode'
									clearTimeout(cl)
								}, 2000)


							}

						}
					},
					fail(res) {
						that.loadModal = false
						uni.showToast({
							icon: 'none',
							duration: 2000,
							title: '未登录'
						})
						let cl = setTimeout(() => {
							window.location.href = '/wx/GetCode'
							clearTimeout(cl)
						}, 2000)
					}
				})



			},
			confirm() {
				this.IsSet = false
				this.IsRelieve = false
				uni.navigateTo({
					url: '/pages/submit/CompleteInformation?userId=' + this.userId
				})
			},
			message() {
				uni.redirectTo({
					url: '/pages/submit/informer'
				})
				this.IsSet = false
			},
			mit() {
				uni.navigateTo({
					url: '/pages/submit/PastRecords'
				})
				this.IsSet = false
			},
			hange(e) { //选择上报人
				var that = this
				that.index = e.detail.value
				if (that.index == -1) {
					that.index = 0
				}
			},

			getshangbao() {
				var that = this
				that.loadModal = true
				uni.request({
					method: 'POST',
					url: App.globalData.baseUrl + '/api/services/app/organUser/SubmitUserHealth',
					data: {
						"id": 0,
						"userId": that.arrId[that.index].userId,
						"reportTime": that.date,
						"temperature": that.tiwen,
						"DoNucleicAcidTest":that.hsjc[that.ins5].value,//是否做过核酸检测
						"FirstResult":that.ins6==null?'':that.firstList[that.ins6].value,//第一次检测情况
						"SecondResult":that.ins7==null?'':that.twoList[that.ins7].value,//第二次检测情况
						"SelfCurrentArea":that.site[that.ins8].value,//本人现在所处区域
						"DoNucleicAcidTestReason":that.texent,//未进行核酸检测原因
						"selfHealthy": that.lisp[that.grt].value,
						"familyHealthy": that.list[that.on].value,
						"helpMethed": that.liser[that.ins].value,
						"testPerson": that.person,
						"status": 0,
					},
					success(res) {
						// var objset = {}
						if (res.data.success == true) {
							const resArr=uni.getStorageSync('resArr')
							let userId=that.arrId[that.index].userId
							if(resArr.length>0){
							    let ra=resArr.findIndex((item)=>{
							    	return item.userId==userId
							    })
								// console.log(ra)
							    if(ra==-1){
									// console.log(66666)
									resArr.push({userId:userId, time:that.times, date:that.date})	
							    }else{
									resArr[ra]={userId:userId, time:that.times, date:that.date}
							    }	
							}else{
								// console.log(777777)
								resArr.push({userId:userId, time:that.times, date:that.date})
							}
							uni.setStorageSync('resArr', resArr)
							that.istrue = ''
							that.loadModal = false;//等待转圈
							that.isFalse=true;//判断不重复点击
							that.modalName='Image';//弹窗
							
						} else {
							let str=res.data.error.message
							let strTure=str.includes('已经')
							if(strTure==true){
								const resArr=uni.getStorageSync('resArr')
								let userId=that.arrId[that.index].userId
								if(resArr.length>0){
								    let ra=resArr.findIndex((item)=>{
								    	return item.userId==userId
								    })
									// console.log(ra)
								    if(ra==-1){
										// console.log(66666)
										resArr.push({userId:userId, time:that.times, date:that.date})	
								    }else{
										resArr[ra]={userId:userId, time:that.times, date:that.date}
								    }	
								}else{
									// console.log(777777)
									resArr.push({userId:userId, time:that.times,  date:that.date})
								}
								uni.setStorageSync('resArr', resArr)
							}
							that.isFalse=true
							that.loadModal = false
							uni.showToast({
								icon: 'none',
								title: res.data.error.message,
								duration: 4000
							})
							
							if (res.data.error.code == 401) {
								
								uni.showToast({
									icon: 'none',
									duration: 2000,
									title: '马上开始重新登录'
								})
								let cl = setTimeout(() => {
									window.location.href = '/wx/GetCode'
									clearTimeout(cl)
								}, 2000)
							}
						}
					},
					fail(res) {
						that.isFalse=true
						that.loadModal = false
						uni.showToast({
							title: res.data.error.message,
							duration: 4000,
							icon: 'none',
						})
					}
				})
			},

			sub() {
				var that=this
				if(that.grt==4){
					that.ins5=1;
					that.texent='';
				}
				if(that.ins5==1){
					that.ins6=null;
					that.ins7=null;
					that.ins8=1;
				}else{
					if(that.ins7==0||that.ins7==1||that.ins7==2){
						that.texent=''
					}
				}
				
				if (that.index == -1) {
					uni.showToast({
						title: '上报人为空',
						duration: 1000,
						icon: 'none'
					});
				} else if (that.date == '请输入时间') {
					uni.showToast({
						title: '时间为空',
						duration: 1000,
						icon: 'none'
					});
				} else if (that.tiwen == '') {
					uni.showToast({
						title: '体温为空',
						duration: 1000,
						icon: 'none'
					});
				} else if (that.person == '') {
					uni.showToast({
						title: '检测人为空',
						duration: 1000,
						icon: 'none'
					});
				} else if (that.grt == null || that.ins == null || that.on == null) {
					uni.showToast({
						title: '单项选择请填写完',
						duration: 1000,
						icon: 'none'
					});
				} else if(that.ins5==0 && that.ins6==null){
					uni.showToast({
						title: '请填报第一次检测情况',
						duration: 1000,
						icon: 'none'
					});
				}else if(that.ins5==0 && that.ins7==null){
					uni.showToast({
						title: '请填报第二次检测情况',
						duration: 1000,
						icon: 'none'
					});
				}else if((that.grt!=4&&that.ins5==0 && that.ins7==3&&that.texent=='')||(that.grt!=4&&that.ins5==1&&that.texent=='')){
					uni.showToast({
						title: '请填报未进行核酸检测原因',
						duration: 1000,
						icon: 'none'
					});
				}else {
					if(that.isFalse==true){
						that.isFalse=false;//判断不重复点击
						that.getTime()//获取最新的时间
						const resArr=uni.getStorageSync('resArr')//获取缓存的userid和时间
						// console.log(888888, resArr)
						let userId=that.arrId[that.index].userId//获取当前上报人userid
						if(resArr.length>0){//判断缓存的数组的长度
							let ra=resArr.findIndex((item, index)=>{
								return item.userId==userId
							})
							if(ra==-1){//没有找到当前的userid直接走接口
								that.getshangbao()
							}else{//找到判断当前是否大于缓存时间十分钟以上
								let ims=Number(resArr[ra].time+10)//找到当前上报缓存的时间加十分钟
								// console.log(ims, that.times)
								if(that.times>ims){//当前大于缓存以后的时间加十分钟
									that.getshangbao()
								}else{//小于十分钟之内isFalse等于true,提醒他十分钟之后再试
									that.isFalse=true
									uni.showToast({
										title: '您已提交成功，请勿重复提交',
										duration: 3000,
										icon: 'none'
									});
								}
							}
						}else{
							that.getshangbao()
						}
						
						
					}
					
				}
			}
		}
	}
</script>

<style>
	.box {
		width: 100%;
		height: 100%;
	}

	.head {
		height: 120rpx;
		width: 100%;
		background-color: #FFFFFF;
		padding: 0 30rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 30rpx;
		position: fixed;
		top: 0rpx;
		left: 0rpx;
		z-index: 99;
	}

	.head_left {
		display: flex;
		align-items: center;
	}

	.head_right {
		position: relative;
	}

	.windows {
		position: absolute;
		top: 60rpx;
		right: 10rpx;
		z-index: 100;
	}

	.windows_box {
		width: 260rpx;
		background: #FFFFFF;
		padding: 0 30rpx;
		box-sizing: border-box;
		box-shadow: 0rpx 0rpx 6rpx #000;
		border-radius: 10rpx;
	}

	.windows_box>view {
		width: 100%;
		height: 90rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		text-align: center;
		line-height: 90rpx;
	}

	.windows_box>view:nth-child(1) {
		border-bottom: 1rpx solid #DDDDDD;
	}

	.dian {
		width: 100%;
		height: 120rpx;
	}

	.imgt>image {
		width: 100%;
		height: 360rpx;
	}

	.content {
		width: 100%;
	}

	.content>.rttt {
		border-bottom: 0rpx;
	}

	.school {
		width: 100%;
		padding: 0 30rpx;
		box-sizing: border-box;
		background: #FFFFFF;
	}

	.date {
		border-top: 1rpx solid #DDDDDD;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: relative;
	}

	.date>view:nth-child(2) {
		display: flex;
		align-items: center;
	}

	.date>view:nth-child(2)>text {
		font-size: 30rpx;
	}

	.date>view:nth-child(2)>image {
		width: 16rpx;
		height: 30rpx;
		margin-left: 20rpx;
	}

	.AnimalHeat {
		width: 100%;
		height: 100rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		background-color: #FFFFFF;
	}

	.AnimalHeat>view {
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-top: 1rpx solid #D8D8D8;
	}

	.AnimalHeat>view>input {
		flex: 1;
		text-align: right;
	}

	.radios {
		margin-top: 20rpx;
		display: flex;
		align-items: center
	}

	.submit {
		width: 100%;
		height: 240rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.submit>view {
		width: 400rpx;
		height: 100rpx;
		background: #1CBBB4;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 60rpx;
	}

	.box_one {
		padding: 0 30rpx;
		align-items: center;
		box-sizing: border-box;
		background: #FFFFFF;
	}

	.boxEs {
		border-top: 1rpx solid #DDDDDD;
		padding: 30rpx 0;
		box-sizing: border-box;
	}
    .boxEs>view:nth-child(1)>text:nth-child(1){margin-right: 20rpx;}
	.box_one>.sex {
		height: 80rpx;
		display: flex;
		align-items: center;
	}
    .weiConent{
		width: 100%;
		padding: 30rpx 0rpx 0;
		margin-top: 20rpx;
		border-top: 1rpx solid #DDDDDD;
	}
	.weiConent>view{font-size: 28rpx;}
    .weiConent>textarea{
		width: 100%;
		height: 300rpx;
		border: 1rpx solid #EDE1D9;
		padding: 20rpx;
		margin-top: 20rpx;
	}
	.submit .grtReds{background-color: #FC4242;}


	/* 弹窗 */
	.MaskLayer {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0rpx;
		left: 0rpx;
		background: #000000;
		opacity: 0.6;
		/* z-index: 101; */
	}

	.gif>view>image {
		width: 160rpx;
		height: 160rpx;
	}

	.gif>view>view {
		color: #FFFFFF;
		text-align: center;
		margin-top: 10rpx;
		font-size: 28rpx;
	}

	.CPM,
	.gif {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		top: 0;
		left: 0;
		/* z-index: 101; */
	}

	.CPM_box {
		width: 400rpx;
		height: 300rpx;
		border-radius: 50rpx;
		background: rgb(241, 241, 241);
		padding: 50rpx;
		position: relative;
	}

	.CPM_box>view:nth-child(1) {
		font-size: 34rpx;
		text-align: center;
		margin-top: 20rpx;
	}

	.CPM_box>view:nth-child(2) {
		font-size: 30rpx;
		width: 100%;
		height: 80rpx;
		border-radius: 45rpx;
		margin-top: 40rpx;
		background-color: #1CBBB4;
		color: #FFFFFF;
		text-align: center;
		line-height: 80rpx;
	}

	.CPM_box>view:nth-child(3) {
		font-size: 30rpx;
		width: 100%;
		height: 80rpx;
		border-radius: 45rpx;
		margin-top: 40rpx;
		background-color: rgb(201, 201, 201);
		color: #FFFFFF;
		text-align: center;
		line-height: 80rpx;
	}
	
	.cu-dialog {
	    width: 600rpx;
		padding:50rpx 30rpx;
		box-sizing: border-box;
	    background-color: #FFFFFF; 
	}
	.xinwentex{
		padding:30rpx;
		box-sizing: border-box;
		background-color: #FFFBE9;
		border-top: 6rpx solid #FF855F;
		margin-bottom: 50rpx;
	}
	.xinwentex>view{
		text-align: left;
		color: #DB2525;
		font-size: 30rpx;
	}
	.qued>view{
		width: 400rpx;
		height: 80rpx;
		border-radius: 45rpx;
		background-color: #1ED6B1;
		color: #FFFFFF
	}
</style>
